# -*- coding: utf-8 -*-
# @Time    : 2022/1/11 18:28
# @Author  : 徐翊宸
# @Email   : xyc@163.com
# @File    : page_smtp.py
# @Software: PyCharm
from selenium.webdriver.common.by import By
from pages.base_page import BasePage


class SmtpPage(BasePage):

    toux_locator = (By.CSS_SELECTOR, "body > div.navbar.navbar-inverse.navbar-fixed-top > div > div > div.nav-collapse.collapse > ul.nav.pull-right > li:nth-child(6) > a > img")
    xtsz_submit_locator = (By.LINK_TEXT, "系统设置")
    smtpsz_locator = (By.LINK_TEXT, "SMTP设置")
    yxdz_locator = (By.CSS_SELECTOR, "#address")
    fwqdz_locator = (By.CSS_SELECTOR, "#smtp")
    fwqdkh_locator = (By.CSS_SELECTOR, "#port")
    dlm_locator = (By.CSS_SELECTOR, "#loginName")
    mima_locator = (By.CSS_SELECTOR, "#password")
    ceyx_locator = (By.CSS_SELECTOR, "#test_email")
    ceshi_submit_locator = (By.CSS_SELECTOR, "#test")
    bc_locator = (By.CSS_SELECTOR, "body > div.container > div.tabbable > div > form > table > tbody > tr:nth-child(14) > td:nth-child(2) > input")

    def toux_click(self):
        self.driver.find_element(*self.toux_locator).click()

    def xtsz_click(self):
        self.driver.find_element(*self.xtsz_submit_locator).click()

    def smtpsz_click(self):
        self.driver.find_element(*self.smtpsz_locator).click()

    def yxdz_input(self, yxdz):
        self.driver.find_element(*self.yxdz_locator).clear()
        self.driver.find_element(*self.yxdz_locator).send_keys(yxdz)

    def fwqdz_input(self, fwqdz):
        self.driver.find_element(*self.fwqdz_locator).clear()
        self.driver.find_element(*self.fwqdz_locator).send_keys(fwqdz)

    def fwqdkh_input(self, fwqdkh):
        self.driver.find_element(*self.fwqdkh_locator).clear()
        self.driver.find_element(*self.fwqdkh_locator).send_keys(fwqdkh)

    def dlm_input(self, dlm):
        self.driver.find_element(*self.dlm_locator).clear()
        self.driver.find_element(*self.dlm_locator).send_keys(dlm)

    def miam_input(self, mima):
        self.driver.find_element(*self.mima_locator).clear()
        self.driver.find_element(*self.mima_locator).send_keys(mima)

    def ceyx(self, ceyx):
        self.driver.find_element(*self.ceyx_locator).clear()
        self.driver.find_element(*self.ceyx_locator).send_keys(ceyx)

    def bc_click(self):
        self.driver.find_element(*self.bc_locator).click()


